package com.wlx.mapper;


import com.wlx.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {

    //@Select("select count(*) from emp")
    //public Integer count();

    //@Select("select * from emp limit #{start},#{pageSize}")
    //public List<Emp> page(@Param("start")Integer start, @Param("pageSize") Integer pageSize);

    /*
    * 分页查询
    * */
    //@Select("select * from emp")
    public List<Emp> list(@Param("name")String name, @Param("gender")Short gender,
                          @Param("begin") LocalDate begin,@Param("end") LocalDate end);


    void delete(List<Integer> ids);

    void insert(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp getById(Integer id);

    /*
    * 更新员工
    * */
    void update(Emp emp);

    //根据用户名和密码查询信息
    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getByUsernameAndPassword(Emp emp);


    @Delete("delete from emp where dept_id = #{deptId}")
    void deleteByDeptId(Integer deptId);
}
